Imports Microsoft.VisualBasic
Imports System

Namespace $RootNamespace$

    ''' <summary>
    ''' The '$Abstraction$' class
    ''' </summary>
    Friend Class $Abstraction$
        ' Property
        Private _implementor As $Implementor$
        Public Property $Implementor$() As $Implementor$
            Get
                Return _implementor
            End Get
            Set(ByVal value As $Implementor$)
                _implementor = value
            End Set
        End Property

        Public Overridable Sub Operation()
            $Implementor$.OperationImp()
        End Sub
        ''' <summary>
        ''' Just for testing.
        ''' </summary>
        Public Shared Sub Test()
            Dim abstraction As $Abstraction$ = New $RefinedAbstraction$()

            ' Set implementation and call
            abstraction.$Implementor$ = New ConcreteImplementorA()
            Abstraction.Operation()

            ' Change implemention and call
            abstraction.$Implementor$ = New ConcreteImplementorB()
            Abstraction.Operation()
        End Sub
    End Class



    ''' <summary>
    ''' The '$Implementor$' abstract class
    ''' </summary>
    Friend MustInherit Class $Implementor$
        Public MustOverride Sub OperationImp()
    End Class



    ''' <summary>
    ''' The '$RefinedAbstraction$' class
    ''' </summary>
    Friend Class $RefinedAbstraction$
        Inherits $Abstraction$
        Public Overrides Sub Operation()
            $Implementor$.OperationImp()
        End Sub
    End Class



    ''' <summary>
    ''' The 'ConcreteImplementorA' class
    ''' </summary>
    Friend Class ConcreteImplementorA
        Inherits $Implementor$
        Public Overrides Sub OperationImp()
            Console.WriteLine("OperationA")
        End Sub

    End Class



    ''' <summary>
    ''' The 'ConcreteImplementorB' class
    ''' </summary>
    Friend Class ConcreteImplementorB
        Inherits $Implementor$
        Public Overrides Sub OperationImp()
            Console.WriteLine("OperationB")
        End Sub

    End Class


End Namespace

